//统一管理首页相关的请求
import request from "@/util/request.ts";
import type {HospitalResponseData} from "@/api/home/type.ts";
import {HospitalInfo, HospitalLevelAndRegionResponseData} from "@/api/home/type.ts";
//通过枚举管理首页模块的接口
enum Api{
    //获取已有的医院的数据接口地址
     HOSPITAL_URL = '/hosp/hospital/',
     //获取医院的等级与地区
     HOSPITALLEVELANDREGION_URL = "/cmn/dict/findByDictCode/",
     //根据关键字获取医院名称列表
     HOSPITALINFO_URL = '/hosp/hospital/findByHosname/'
}
//获取医院的数据
export const reqHospital = (page:number,limit:number,hostype='',districtCode='')=>
        request.get<any,HospitalResponseData>((Api.HOSPITAL_URL+`${page}/${limit}?hostype=${hostype}&districtCode=${districtCode}`))

//获取医院的等级或者地区数据
export const reqHospitalLevelAndRegion = (dictCode:string)=>
    request.get<any,HospitalLevelAndRegionResponseData>(Api.HOSPITALLEVELANDREGION_URL + `${dictCode}`)

export const reqHospitalInfo = (hosname:string)=>
    request.get<any,HospitalInfo>(Api.HOSPITALINFO_URL+`${hosname}`)